package com.niit.session18;

import java.util.Map;
import java.util.TreeMap;

public class TreeMapDemo {
	public static void main(String[] args) {
//		TreeMap可以把添加进去的元素根据键来排序
		Map<Integer, Student> map = new TreeMap<Integer, Student>();
		Student student1 = new Student("张三",21);
		Student student2 = new Student("李四",18);
		Student student3 = new Student("王五",22);
//		map里也可以装我们自己定义的对象
		map.put(19, student1);
		map.put(11, student2);
		map.put(8, student3);
		System.out.println(map);
	}

}
